package com.eascs.ticket.configuration.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.eascs.ticket.common.service.BaseSevice;
import com.eascs.ticket.configuration.entity.TicketStatus;
import com.eascs.ticket.configuration.entity.TicketStatusUpdate;

@Service
public class TicketStatusService extends BaseSevice {
	public List<Object[]> getAllStatus() {
		return this.proxyDao.findObjectsList("select id,name,ticket_status_type,order_code,comments from ticket_status order by order_code");
	}

	public List<Object[]> getAllStatusDataSource() {
		return this.proxyDao.findObjectsList("select id,name from ticket_status order by order_code");
	}

	public TicketStatus getTicketStatusById(String ticketStatusId) {
		return this.proxyDao.getById(TicketStatus.class, ticketStatusId);
	}

	@Transactional(transactionManager = "ticketTransactionManager")
	public void insertTicketStatus(TicketStatus ticketStatus) {
		this.proxyDao.insert(ticketStatus);
	}

	@Transactional(transactionManager = "ticketTransactionManager")
	public void updateTicketStatus(TicketStatusUpdate ticketStatusUpdate) {
		this.proxyDao.updateById(ticketStatusUpdate);
	}
}
